<?php
	include "../../config.php";
?>
<?php
		if(!$_POST){// chua co du lieu gui len
			include ADMIN_ROOT."views/products/add.php";	
		}
		else{ // co du lieu gui len
			$name=$_POST['txtname'];
			$desc=$_POST['txtdes'];
			$cate_id=$_POST['cartegory_id'];
			$size = $_POST['txtsize'];
			$price = $_POST['txtprice'];
			$ava=$_POST['txtava'];
			$picture = $_POST['picture'];
			$note = $_POST['txtnote'];
			include DOC_ROOT."lib/connection.php";
			$con = sqlsrv_connect(SERVER,$conInfo);
			$stmt= sqlsrv_query($con,"INSERT INTO users VALUES(?,?,?,?,?,?,?,?)",array($name,$desc,$cate,$size,$price,$ava,$picture,$note));
			header("location:../index.php");			
		}
	?>